package com.wuseguang.springcloud.service.impl;

import com.wuseguang.springcloud.dao.repository.MeMoralEducationLabelRepository;
import com.wuseguang.springcloud.entity.MeMoralEducationLabel;
import com.wuseguang.springcloud.service.MeMoralEducationLabelService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 德育项标签 服务实现类
 * </p>
 *
 * @author 
 * @since 2020-07-21
 */
@Service
public class MeMoralEducationLabelServiceImpl  implements MeMoralEducationLabelService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private MeMoralEducationLabelRepository meMoralEducationLabelRepository;

    @Override
    public Result findMeMoralEducationLabel(String schoolId) {
        logger.info("查询学校德育标签");
        List<MeMoralEducationLabel> list = meMoralEducationLabelRepository.findbySchoolId(Integer.valueOf(schoolId));
        return new Result(list);
    }

    @Override
    public Result addMeMoralEducationLabel(MeMoralEducationLabel meMoralEducationLabel) {
        logger.info("添加学校德育标签");
        meMoralEducationLabelRepository.save(meMoralEducationLabel);
        return new Result();
    }

    @Override
    public Result deleteMeMoralEducationLabel(Integer id) {
        meMoralEducationLabelRepository.deleteById(id);
        return new Result();
    }


}
